define(() => {
    return function (cont, serverData, localData) {
        let str = "";
        serverData.forEach(val1 => {
            localData.forEach(val2 => {
                if (val1.imgId === val2.id) {
                    str += `<tr data-id="${val2.id}">
                        <td><input type="checkbox" ${val2.flag ? "checked" : ""} class="check"></td>
                        <td><img src="${val1.img}" alt=""></td>
                        <td>${val1.name}</td>
                        <td class="count"><button class="jian">-</button><input class="input" value="${val2.num}" /><button class="jia">+</button></td>
                        <td>${val1.price}</td>
                        <td id="allPrice">${val1.price * val2.num}</td>
                        <td class="del">删除</td>
                    </tr>`;
    
                }
    
            })
        })
        cont.html(str);
        console.log($('.input'))
        // let arr= []
        // arr.push()
        $('.input').click(function () {
            console.log(this.value)
        })
        // console.log($('.jian'))
        $('.jian').click(function () {
            let a = $(this).next().val();
    
            if (a <= 0) {
                alert('没有了')
                a = 0;
            } else {
                a--
            }
            // console.log(a)
            $(this).next().val(a)
        })
        $('.jia').click(function () {
            let a = $(this).prev().val();
            a++
            // console.log(a)
            $(this).prev().val(a)
        })
    }
})